package com.acmen.easyapi.executor;

import com.acmen.easyapi.model.Response;
import com.acmen.easyapi.dto.UnitTestAdd;
import com.acmen.easyapi.repository.UnitTestRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.UUID;

/**
 * @author acmen
 * 保存测试执行器
 */
@Component
public class UnitTestSaveExe {

    @Autowired
    private UnitTestRepository unitTestRepository;
    public Response save(UnitTestAdd unitTest) {
        unitTest.setId(UUID.randomUUID().toString().replace("-", ""));
        return Response.build(unitTestRepository.save(unitTest));
    }

    public Response joinPressureTest(String id,boolean join) {
        return Response.build(unitTestRepository.joinPressureTest(id,join));
    }
}
